package com.gewu.pm.ui.activity.terminal;

import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.TextView;

import com.gewu.pm.R;
import com.gewu.pm.aop.SingleClick;
import com.gewu.pm.app.AppActivity;
import com.gewu.pm.other.IntentKey;
import com.gewu.pm.ui.dialog.TipsTwoDialog;

/**
 * 联系人详情-终端联系人
 */
public class ContactDetailsActivity extends AppActivity {
    private TextView tvContactName;
    private TextView tvContactPhone;
    private TextView tvPrimaryValue;//是否是主联系人
    private TextView tvPrimaryTag;//客户账号已开通
    private TextView tvCreateTime;//创建时间
    private TextView tvCreator;//创建人
    private TextView tvModificationTime;//修改时间
    private TextView tvModifier;//修改人

    public static void start(Context context, String name) {
        Intent intent = new Intent(context, ContactDetailsActivity.class);
        intent.putExtra(IntentKey.NAME, name);
        context.startActivity(intent);
    }

    @Override
    protected int getLayoutId() {
        return R.layout.activity_contact_details;
    }

    @Override
    protected void initView(Bundle savedInstanceState) {
        tvContactName = findViewById(R.id.tv_contact_name);
        tvContactPhone = findViewById(R.id.tv_contact_phone);
        tvPrimaryValue = findViewById(R.id.tv_primary_value);
        tvPrimaryTag = findViewById(R.id.tv_primary_tag);
        tvCreateTime = findViewById(R.id.tv_create_time);
        tvCreator = findViewById(R.id.tv_creator);
        tvModificationTime = findViewById(R.id.tv_modification_time);
        tvModifier = findViewById(R.id.tv_modifier);

        setOnClickListener(R.id.iv_chat, R.id.iv_email, R.id.iv_phone, R.id.tv_delete, R.id.tv_edit);

    }

    @Override
    protected void initData() {
        setTitle(getString(IntentKey.NAME) + "详情");

    }

    @SingleClick
    @Override
    public void onClick(View view) {
        super.onClick(view);
        int id = view.getId();
        if (id == R.id.iv_chat) {//聊天
            toast("聊天");
        } else if (id == R.id.iv_email) {//邮箱
            toast("邮箱");
        } else if (id == R.id.iv_phone) {//电话
            toast("电话");
        } else if (id == R.id.tv_delete) {//删除
            new TipsTwoDialog.Builder(getContext()).setTitle("您确定删除联系人吗").setListener(dialog -> {
                toast("删除");
            }).show();
        } else if (id == R.id.tv_edit) {//编辑
            toast("编辑");
        }
    }
}